home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Warrior’s Progress / source code / Source / Libraries / Drawing / GraphicsDeviceLoop.h < prev    next >
Encoding:
Text File  |  1997-06-28  |  632 b   |  31 lines  |  [TEXT/CWIE]

  1. // GraphicsDeviceLoop.h
  2.  
  3. #ifndef GraphicsDeviceLoop_h
  4. #define GraphicsDeviceLoop_h
  5.  
  6. #ifndef GraphicsDeviceObject_h
  7. #include "GraphicsDeviceObject.h"
  8. #endif
  9.  
  10. class GraphicsDeviceLoop
  11.   {
  12.     private:
  13.         GDHandle device;
  14.     
  15.     public:
  16.         GraphicsDeviceLoop()
  17.           : device( GraphicsDeviceObject::First() )
  18.           {}
  19.         
  20.         bool Finished() const        { return device == 0; }
  21.         bool Unfinished() const        { return device != 0; }
  22.         
  23.         void operator++()                { Assert( Unfinished() ); device = (**this).Next(); }
  24.         void operator++(int)            { operator++(); }
  25.  
  26.         GraphicsDeviceObject operator*() const        { return device; }
  27.         // Sorry, no operator->().
  28.   };
  29.  
  30. #endif
  31.